﻿<%@ Page Title="Business Partner List" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="DocumentProfile.aspx.cs" Inherits="VSM.DocumentProfile" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function OpenUpload() {
            var url = "UploadPopup.aspx";
            Main.openCustomDialog(url, 900, 290, "Upload Documents");
        }
    </script>
    <h2>
        <asp:Label ID="lblTitle" runat="server" Text="Document List" />
    </h2>
    <asp:HiddenField ID="hdnisUpdate" runat="server" />
   <%-- <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>--%>
            <div style="margin-left: 5px; width: 99%;">
                <hr />
                <table border="0" width="100%" style="background-color: #D1D4D8; font-weight: bold;">
                    <tr>
                        <td style="width: 50px">Validity:
                        </td>
                        <td style="width: 120px">
                            <asp:DropDownList ID="ddlValidity" runat="server" AutoPostBack="True" >
                                <asp:ListItem Value="0">Valid</asp:ListItem>
                                <asp:ListItem Value="1">Invalid</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td style="width: 100px">Document Type:</td>
                        <td >
                            <asp:DropDownList ID="ddlDocType_1" runat="server" >
                                <asp:ListItem Value="0">Policy</asp:ListItem>
                                <asp:ListItem Value="1">Training</asp:ListItem>
                                <asp:ListItem Value="2">Dealers Standard</asp:ListItem>
                                <asp:ListItem Value="3">MKT material</asp:ListItem>
                                <asp:ListItem Value="4">Others</asp:ListItem>
                                <asp:ListItem Value="5"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table>
                <hr />
                <table style="width: 100%;" border="0">
                    <tr>
                        <td style="width: 35%">
                            <asp:Button ID="btnUpload" runat="server" Text="New Upload" Style="background-image: url('/Images/bgButton.png');
                                background-repeat: no-repeat;" OnClientClick="OpenUpload(); return false;" />
                        </td>
                        <td style="width: 65%">
                            <asp:Label ID="lblError" runat="server" Visible="False" Font-Bold="True" ForeColor="Red"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:GridView ID="grvItem" CssClass="GridInner" runat="server" Width="100%" BorderColor="White"
                                BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                                HeaderStyle-Height="27px" CellSpacing="2"
                                HeaderStyle-VerticalAlign="Middle"
                                OnRowDataBound="grvSearchResult_RowDataBound"   AllowPaging="True" 
                                OnPageIndexChanging="grvSearchResult_PageIndexChanging" PageSize="20" 
                                onrowcreated="grvItem_RowCreated">
                                <PagerSettings Mode="NumericFirstLast" />
                                <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                                <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                                <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                                <Columns>
                                    <asp:TemplateField HeaderText="Action">
                                        <ItemStyle HorizontalAlign="Center"  Width="3%"/>
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete" OnClick="lnkDelete_Click" OnClientClick='return confirm("Are you sure to delete?");' />
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                <asp:TemplateField HeaderText="No.">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblNo" runat="server" Text='<%# Bind("No") %>' BorderStyle="none" />
                                            <asp:HiddenField ID="hdnInternalID" Value='<%# Bind("internal_id") %>' runat="server"/>
                                            <asp:HiddenField ID="hdnFileName" Value='<%# Bind("file_name") %>' runat="server"/>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                    <asp:TemplateField HeaderText="Title">
                                        <ItemStyle HorizontalAlign="Left" />
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:Label ID="lblTitle" runat="server" Text='<%# Bind("title") %>' BorderStyle="none" />
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="Publish Date">
                                        <ItemStyle HorizontalAlign="Center" Width="10%" />
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:Label ID="lblPublicDate" runat="server" Text='<%# Bind("publish_date") %>' BorderStyle="none" />
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="Valid to Date">
                                        <ItemStyle HorizontalAlign="Center" Width="10%" />
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:Label ID="lblValid2Date" runat="server" Text='<%# Bind("valid_date") %>' BorderStyle="none" />
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="Validity">
                                        <ItemStyle HorizontalAlign="left" Width="6%" />
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:DropDownList ID="ddlDocType" AutoPostBack="true" onselectedindexchanged="ddlDocType_SelectedIndexChanged" Width="99%" runat="server">
                                                <asp:ListItem Value="0">Valid</asp:ListItem>
                                                <asp:ListItem Value="1">Invalid</asp:ListItem>
                                            </asp:DropDownList>
                                            <asp:HiddenField ID="hdnIsInvalid" Value='<%# Bind("isinvalid") %>' runat="server"/>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="Document Type">
                                        <ItemStyle HorizontalAlign="Center" Width="8%" />
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:Label ID="lblDocumentType" runat="server" Text='<%# Bind("document_type") %>' BorderStyle="none" />
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="File Type">
                                        <ItemStyle HorizontalAlign="Center" Width="8%" />
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:Label ID="lblFileType" runat="server" Text='<%# Bind("file_type") %>' BorderStyle="none" />
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="Download">
                                        <ItemStyle HorizontalAlign="Center"  Width="6%"/>
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lnkDownload" runat="server" Text="Download" OnClick="lnkDownload_Click" />
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                </Columns>
                                <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False" Height="27px" VerticalAlign="Bottom" />
                                <EmptyDataTemplate>
                                    <table class="GridInner" style="width: 100%; border-color: White;" border="1" rules="all"
                                        cellspacing="2" cellpadding="2">
                                        <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none; background-color: rgb(96, 149, 201);">
                                            <th style="width: 3%">
                                                <span>Action</span>
                                            </th>
                                            <th style="width: 20px">
                                                <span>No.</span>
                                            </th>
                                            <th >
                                                <span>Title</span>
                                            </th>
                                            <th style="width: 10%">
                                                <span>Publish Date</span>
                                            </th>
                                            <th style="width: 10%">
                                                <span>Valid to Date</span>
                                            </th>
                                            <th style="width: 6%">
                                                <span>Validity</span>
                                            </th>
                                            <th style="width: 8%">
                                                <span>Document Type</span>
                                            </th>
                                            <th style="width: 8%">
                                                <span>File Type</span>
                                            </th>
                                            <th style="width: 6%">
                                                <span>Download</span>
                                            </th>
                                        </tr>
                                        <tr>
                                            <td colspan="9">
                                                <span>No Data</span>
                                            </td>
                                        </tr>
                                    </table>
                                </EmptyDataTemplate>
                            </asp:GridView>
                        </td>
                    </tr>
                </table>
            </div>
            <table width="100%" border="0">
                <tr>
                    <td colspan="2">
                        <div style="margin-left: 5px; width: 99%;">
                            <hr />
                        </div>
                        <table style="width: 100%">
                            <tr>
                                <td style="width: 250px;">
                                    <asp:Button ID="btnSave" runat="server" Text="Update" Style="background-image: url('/Images/bgButton.png');
                                        background-repeat: no-repeat; color: White;" OnClick="btnSave_Click"  OnClientClick="return confirm('Are you sure?');"
                                        BorderStyle="Solid" Width="80px" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
      <%--  </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger  ControlID="lnkDownload" />
        </Triggers>
    </asp:UpdatePanel>--%>
</asp:Content>
